/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.base.entity.supplier;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 供应商Entity
 * @author LV
 * @version 2021-03-01
 */
@Table(name="t_supplier_business_info", alias="a", columns={
		@Column(name="business_info_id", attrName="businessInfoId", label="工商信息ID", isPK=true),
		@Column(name="business_info_name", attrName="businessInfoName", label="名称", queryType=QueryType.LIKE),
		@Column(name="required", attrName="required", label="是否必填"),
		@Column(name="valid_period_from", attrName="validPeriodFrom", label="有效期起"),
		@Column(name="valid_period_to", attrName="validPeriodTo", label="有效期至"),
		@Column(name="supplier_id", attrName="supplierId.supplierId", label="供应商ID"),
	}, orderBy="a.business_info_id ASC"
)
public class SupplierBusinessInfo extends DataEntity<SupplierBusinessInfo> {
	
	private static final long serialVersionUID = 1L;
	private String businessInfoId;		// 工商信息ID
	private String businessInfoName;		// 名称
	private String required;		// 是否必填
	private Date validPeriodFrom;		// 有效期起
	private Date validPeriodTo;		// 有效期至
	private Supplier supplierId;		// 供应商ID 父类
	
	public SupplierBusinessInfo() {
		this(null);
	}


	public SupplierBusinessInfo(Supplier supplierId){
		this.supplierId = supplierId;
	}
	
	public String getBusinessInfoId() {
		return businessInfoId;
	}

	public void setBusinessInfoId(String businessInfoId) {
		this.businessInfoId = businessInfoId;
	}
	
	@NotBlank(message="名称不能为空")
	@Length(min=0, max=100, message="名称长度不能超过 100 个字符")
	public String getBusinessInfoName() {
		return businessInfoName;
	}

	public void setBusinessInfoName(String businessInfoName) {
		this.businessInfoName = businessInfoName;
	}
	
	@Length(min=0, max=1, message="是否必填长度不能超过 1 个字符")
	public String getRequired() {
		return required;
	}

	public void setRequired(String required) {
		this.required = required;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	@NotNull(message="有效期起不能为空")
	public Date getValidPeriodFrom() {
		return validPeriodFrom;
	}

	public void setValidPeriodFrom(Date validPeriodFrom) {
		this.validPeriodFrom = validPeriodFrom;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	@NotNull(message="有效期至不能为空")
	public Date getValidPeriodTo() {
		return validPeriodTo;
	}

	public void setValidPeriodTo(Date validPeriodTo) {
		this.validPeriodTo = validPeriodTo;
	}
	
	@Length(min=0, max=64, message="供应商ID长度不能超过 64 个字符")
	public Supplier getSupplierId() {
		return supplierId;
	}

	public void setSupplierId(Supplier supplierId) {
		this.supplierId = supplierId;
	}
	
}